(function() {
	var _num = 10;
	var _page = 0;
	Path.on("/user/__basename__.html", function(_current_location) {
		App.set('title', '评价管理');
		_load_eval_page(_num, _page);
	});

	function _load_eval_page(num, page) {
		coAjax.get(appConfig.user.evaluation_with_page_info, {
			num: num,
			page: page
		}, function(result) {
			var info = result.result;
			App.set("$Cache.user.comments.evaluations", info.evaluations);
			page_info = {
				total_num: info.total_num,
				total_page: info.total_page,
				page: info.page,
				num: info.num
			};
			page_info._number_list = [];
			page_info._number_list.length = info.total_page;
			App.set("$Cache.user.comments.page_info", page_info);
		});
	};
	//接口实现，回复评论
	App.set("$Event.user.comments.reply", function(e, vm) {
		var _reply_content = $.trim(vm.get("_reply_content"));
		if (!_reply_content) {
			return
		}
		coAjax.post(appConfig.user.add_comment, {
			reply_id: vm.get("_id"),
			content: _reply_content
		}, function(result) {
			var comments = vm.get("comments");
			comments.unshift(result.result);
			vm.set("comments", comments)
		});
		vm.set("_reply_content", "");
	});
}());